﻿<%@ Page CodeFileBaseClass="AliCMS.Lib.SystemPageBase" %>
<script language="c#" runat="server">
protected string Condition()
{
	StringBuilder condition = new StringBuilder();
	string and = String.Empty;

	if (and == String.Empty && condition.Length != 0)
		and = " AND ";

	#region 关键词
	string keyword = Request.QueryString["Keyword"];
	if (!String.IsNullOrEmpty(keyword))
	{
		condition.Append(and + "(" + Alias.Log.IP + " LIKE '%" + keyword + "%' or " + Alias.Log.URL + " LIKE '%" + keyword + "%' or " + Alias.Log.Referrer + " LIKE '%" + keyword + "%' or " + Alias.Log.Message + " LIKE '%" + keyword + "%')");
	}
	#endregion
	
	return condition.ToString();
}
</script>
<section data-page="log_list" data-title="日志列表">
	<dl class="path1">
		<dt><span>您的位置：</span>日志列表</dt>
		<dd>
			<select data-class="<%=ContentLang%>Font" data-ali-widget="combo">
				<ali:List Object="Language" Source="Manager.Languages">
					<ali:Record>
						<%If Convert.ToString(Ab) == ContentLang%>
							<option value="<%=Ab%>" selected><%=[AliCMS.SystemModule.Alias.Language.Name + PageLang]%></option>
						<%Else%>
							<option value="<%=Ab%>"><%=[AliCMS.SystemModule.Alias.Language.Name + PageLang]%></option>
						<%EndIf%>
					</ali:Record>
				</ali:List>
			</select>
		</dd>
	</dl>
	<form action="?Lang=<%=ContentLang%>" class="search1">
		<input name="Keyword" size="50" class="ali-input CHSFont">
		<button type="submit" class="ali-button">搜索</button>
	</form>
	<ul class="toolbar1">
		<li class="select-all"><a><span>全选</span></a></li>
		<li class="select-reverse"><a><span>反选</span></a></li>

		<li class="delete" data-operation="Delete"><a><span>删除</span></a></li>
		<li data-operation="DeleteAll"><a><span>清空</span></a></li>
		<li data-operation="Refresh"><a><span>刷新</span></a></li>
	</ul>
	<div class="content">
		<table data-ali-widget="grid" class="grid1 system-log">
			<tbody>
				<ali:List ID="List" Object="Log" Page="PageNumber" PageSize="PageSizeValue" Condition="Condition()" Validate="True">
					<ali:Record>
						<tr data-id="<%=InnerID%>">
							<td>
								<ul>
									<li><label>时间：</label><%=CreateTime%>， <label>IP：</label><%=IP%></dt>
									<li><label>页面：</label><%=URL%></dt>
									<li><label>来路：</label><%=Referrer%></dt>
									<li><label>描述：</label><%=HttpUtility.HtmlEncode(Convert.ToString(Message)).Replace("\r\n", "<br>")%></dd>
								</ul>
							</td>
						</tr>
					</ali:Record>
				</ali:List>
			</tbody>
		</table>
		<ali:Pagination Page="PageNumber" PageSize="PageSizeValue" RecordCount="List[RecordCount]">
			<div class="pagination1" data-page-number="<%=PageNumber%>" data-page-count="<%=PageCount%>" data-page-size="<%=PageSize%>">
				<div class="pagination1-left">
					共<b><%=PageCount%></b>页，每页显示
						<select name="PageSize" data-ali-widget="combo">
							<option value="20">20</option>
							<option value="50">50</option>
							<option value="100">100</option>
							<option value="200">200</option>
						</select>条，共<b><%=RecordCount%></b>条记录
				</div>
				<ul class="pagination1-right">
					<ali:FirstPage>
						<ali:Yes>
							<li><span><span class="first disabled">首页</span></span></li>
							<li><span><span class="prev disabled">上一页</span></span></li>
						</ali:Yes>
						<ali:No>
							<li><a href="1"><span class="first">首页</span></a></li>
							<li><a href="<%=PageNumber - 1%>"><span class="prev">上一页</span></a></li>
						</ali:No>
					</ali:FirstPage>
					<ali:CurrentPage Range="5">
						<ali:Yes>
							<li class="active"><span><%=Index%></span></li>
						</ali:Yes>
						<ali:No>
							<li><a href="<%=Index%>"><%=Index%></a></li>
						</ali:No>
					</ali:CurrentPage>
					<ali:LastPage>
						<ali:Yes>
							<li><span><span class="next disabled">下一页</span></span></li>
							<li><span><span class="last disabled">末页</span></span></li>
						</ali:Yes>
						<ali:No>
							<li><a href="<%=PageNumber + 1%>"><span class="next">下一页</span></a></li>
							<li><a href="<%=PageCount%>"><span class="last">末页</span></a></li>
						</ali:No>
					</ali:LastPage>

					<li class="go">
						<input type="text" name="PageNumber" value="1" size="4"><button></button>
					</li>
				</ul>
			</div>
		</ali:Pagination>
	</div>
</section>